import {
  baseUrl,
  serverIpA
} from '@/utils/global.js'

const getters = {
  sidebar: state => state.app.sidebar,
  size: state => state.app.size,
  device: state => state.app.device,
  visitedViews: state => state.tagsView.visitedViews,
  cachedViews: state => state.tagsView.cachedViews,
  token: state => state.user.token,
  avatar: state => {
    if (state.user.avatar === '') {
      return 'https://scpic1.chinaz.net/Files/pic/pic9/202108/bpic24047_s.jpg'
    } else {
      return 'http://' + serverIpA + '/file/' + state.user.avatar
    }
  },
  name: state => state.user.name,
  introduction: state => state.user.introduction,
  roles: state => state.user.roles,
  permissions: state => state.user.permissions,
  permission_routes: state => state.permission.routes,
  sidebarRouters: state => state.permission.sidebarRouters,
  logindata: state => state.user.logindata
}
export default getters
